package tech.aistar.corejava.day13;

import java.io.*;

/**
 * @Author: lya
 * @Description: 本类的作用描述:
 * @CreateDate: 2019/8/2
 * @Version: 1.0
 */
public class FileCopyDemo {
    public static void main(String[] args) {
        //JDK7.0语法糖
        //声明在try()中的资源,释放的权限交给了jvm
        try (BufferedReader br = new BufferedReader(new FileReader("src/tech/aistar/corejava/day13/ObjectDemo.java"));
             PrintWriter out = new PrintWriter(new FileWriter("src/tech/aistar/corejava/day13/ObjectDemo_副本.java"))) {

            while (true) {
                String line = br.readLine();//读取一行

                if (line == null) {
                    break;
                }
                out.println(line);
            }

            System.out.println("文件拷贝成功!");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
